package o;

import android.os.Bundle;
import android.widget.TabHost.TabSpec;
import androidx.fragment.app.Fragment;
import com.huawei.appgallery.foundation.service.common.protocol.AppListFragmentProtocol;
import com.huawei.appgallery.foundation.service.common.protocol.request.AppListFragmentRequest;
import java.util.List;
import kotlin.Metadata;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000h\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\t\u0018\u0000 52\u00020\u0001:\u00015B\u0013\u0012\f\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003¢\u0006\u0002\u0010\u0005J\u001c\u0010\u001a\u001a\u00020\u00132\u0006\u0010\u001b\u001a\u00020\u001c2\n\u0010\u001d\u001a\u00060\u001eR\u00020\u001fH\u0016J\b\u0010 \u001a\u00020\u001cH\u0016J\u0012\u0010!\u001a\u0004\u0018\u00010\"2\u0006\u0010\u001b\u001a\u00020\u001cH\u0002J\u0012\u0010#\u001a\u0004\u0018\u00010\"2\u0006\u0010\u001b\u001a\u00020\u001cH\u0016J\u0010\u0010$\u001a\u00020%2\u0006\u0010\u001b\u001a\u00020\u001cH\u0016J\u0012\u0010&\u001a\u0004\u0018\u00010'2\u0006\u0010(\u001a\u00020)H\u0002J\u0010\u0010*\u001a\u00020+2\u0006\u0010,\u001a\u00020-H\u0002J\u0010\u0010.\u001a\u00020+2\b\u0010,\u001a\u0004\u0018\u00010-J\u0018\u0010/\u001a\u00020+2\u0006\u00100\u001a\u00020\"2\u0006\u00101\u001a\u00020\u001cH\u0002J\"\u00102\u001a\u00020+2\u0006\u0010\u001b\u001a\u00020\u001c2\u0006\u00103\u001a\u00020\"2\b\u00104\u001a\u0004\u0018\u00010\"H\u0016R\u001c\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\b\u0010\t\"\u0004\b\n\u0010\u000bR\u001c\u0010\f\u001a\u0004\u0018\u00010\rX\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000e\u0010\u000f\"\u0004\b\u0010\u0010\u0011R\u001a\u0010\u0012\u001a\u00020\u0013X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0012\u0010\u0014\"\u0004\b\u0015\u0010\u0016R \u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003X\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0017\u0010\u0018\"\u0004\b\u0019\u0010\u0005¨\u00066"}, d2 = {"Lcom/huawei/appgallery/foundation/ui/framework/fragment/multitabs/MultiTabsFragmentTabHostAdapter;", "Lcom/huawei/appmarket/support/widget/tabhost/adapter/FragmentTabHostAdapter;", "tabItemList", "", "Lcom/huawei/appmarket/framework/bean/TabItem;", "(Ljava/util/List;)V", "fragmentManager", "Landroidx/fragment/app/FragmentManager;", "getFragmentManager", "()Landroidx/fragment/app/FragmentManager;", "setFragmentManager", "(Landroidx/fragment/app/FragmentManager;)V", "iTabPageListener", "Lcom/huawei/appgallery/foundation/ui/framework/cardframe/listener/ITabPageListener;", "getITabPageListener", "()Lcom/huawei/appgallery/foundation/ui/framework/cardframe/listener/ITabPageListener;", "setITabPageListener", "(Lcom/huawei/appgallery/foundation/ui/framework/cardframe/listener/ITabPageListener;)V", "isSelected", "", "()Z", "setSelected", "(Z)V", "getTabItemList", "()Ljava/util/List;", "setTabItemList", "createTabSpec", "position", "", "tabSpec", "Landroid/widget/TabHost$TabSpec;", "Landroid/widget/TabHost;", "getCount", "getFragment", "Landroidx/fragment/app/Fragment;", "getItem", "getTabSpecTag", "", "getThirdFragmentOffer", "Lcom/huawei/appgallery/foundation/ui/framework/uikit/Offer;", "commonReqInfo", "Lcom/huawei/appgallery/foundation/ui/framework/cardframe/fragment/protocol/bean/CommonReqInfo;", "notifyChanged", "", "bundle", "Landroid/os/Bundle;", "refreshTabPage", "setLazyViewVisible", "fragment", "visibility", "setPrimaryItem", "currObj", "preObj", "Companion", "HiAppBase_release"}, k = 1, mv = {1, 1, 15})
public final class civ extends ewk {
    public static final a ˋ = new a();
    private boolean ˊ;
    @NotNull
    private List<? extends dgp> ˎ;
    @Nullable
    private chu ˏ;
    @Nullable
    private FragmentManager ॱ;

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004XT¢\u0006\u0002\n\u0000¨\u0006\u0005"}, d2 = {"Lcom/huawei/appgallery/foundation/ui/framework/fragment/multitabs/MultiTabsFragmentTabHostAdapter$Companion;", "", "()V", "TAG", "", "HiAppBase_release"}, k = 1, mv = {1, 1, 15})
    public static final class a {
        private a() {
        }
    }

    private final void ॱ(android.os.Bundle r1) {
        /* JADX: method processing error */
/*
Error: jadx.core.utils.exceptions.DecodeException: Load method exception in method: o.civ.ॱ(android.os.Bundle):void
	at jadx.core.dex.nodes.MethodNode.load(MethodNode.java:116)
	at jadx.core.dex.nodes.ClassNode.load(ClassNode.java:249)
	at jadx.core.ProcessClass.process(ProcessClass.java:34)
	at jadx.core.ProcessClass.processDependencies(ProcessClass.java:59)
	at jadx.core.ProcessClass.process(ProcessClass.java:42)
	at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
	at jadx.api.JavaClass.decompile(JavaClass.java:62)
Caused by: java.lang.NullPointerException
*/
        /*
        r0 = this;
        r0 = r6.ˎ;
        r0 = (java.lang.Iterable) r0;
        r1 = 0;
        r3 = r0.iterator();
        r0 = r3.hasNext();
        if (r0 == 0) goto L_0x005d;
    L_0x000f:
        r0 = r3.next();
        r2 = r1 + 1;
        if (r1 >= 0) goto L_0x001a;
        o.frj.ˊ();
        r0 = (o.dgp) r0;
        r1 = r6.ॱ(r1);
        if (r1 != 0) goto L_0x002d;
        r1 = r6.ˏ;
        if (r1 == 0) goto L_0x0029;
        r1.ॱ(r0, r7);
        r1 = r2;
        goto L_0x0009;
        r0 = r1 instanceof o.cic;
        if (r0 == 0) goto L_0x0038;
        r0 = r1;
        r0 = (o.cic) r0;
        r0.ˎ(r7);
        goto L_0x0029;
        r0 = "MultiTabsFragmentTabHostAdapter";
        r4 = new java.lang.StringBuilder;
        r4.<init>();
        r5 = "notifyChanged, fragment = ";
        r4 = r4.append(r5);
        r1 = r4.append(r1);
        r4 = ", iTabPageListener = ";
        r1 = r1.append(r4);
        r4 = r6.ˏ;
        r1 = r1.append(r4);
        r1 = r1.toString();
        o.dna.ˊ(r0, r1);
        goto L_0x0029;
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: o.civ.ॱ(android.os.Bundle):void");
    }

    public final void ˏ(@NotNull List<? extends dgp> list) {
        fsd.ˊ((Object) list, "<set-?>");
        this.ˎ = list;
    }

    public civ(@NotNull List<? extends dgp> list) {
        fsd.ˊ((Object) list, "tabItemList");
        this.ˎ = list;
    }

    public final void ˎ(@Nullable Bundle bundle) {
        if (bundle != null) {
            ॱ(bundle);
        } else {
            Logger.e("MultiTabsFragmentTabHostAdapter", "refreshTabPage, bundle == null");
        }
    }

    public final void ˋ(@Nullable chu o_chu) {
        this.ˏ = o_chu;
    }

    public final void ˊ(@Nullable FragmentManager juVar) {
        this.ॱ = juVar;
    }

    public final void ˊ(boolean z) {
        this.ˊ = z;
    }

    private final Fragment ॱ(int i) {
        String ˊ = ˊ(i);
        FragmentManager juVar = this.ॱ;
        return juVar != null ? juVar.findFragmentByTag(ˊ) : null;
    }

    private final void ˋ(Fragment fragment, int i) {
        Fragment fragment2;
        if (fragment instanceof cid) {
            fragment2 = fragment;
        } else {
            fragment2 = null;
        }
        cid o_cid = (cid) fragment2;
        if (o_cid != null && o_cid.ʽʼ() != i) {
            o_cid.ॱᐝ(i);
        }
    }

    public int ˎ() {
        return this.ˎ.size();
    }

    @Nullable
    public Fragment ˎ(int i) {
        if (CollectCheck.isEmpty(this.ˎ)) {
            Logger.e("AppListFragment", "empty tabItemList. getItem position = " + i);
            return null;
        }
        dgp o_dgp = (dgp) this.ˎ.get(i);
        chx o_chx = new chx();
        o_chx.ˋ(true);
        o_chx.ˊ(o_dgp.ˏ());
        o_chx.ˋ(o_dgp.ॱ());
        o_chx.ˎ(o_dgp.ʽ());
        o_chx.ˋ(o_dgp.ˊ());
        o_chx.ˏ(o_dgp.ˋ());
        o_chx.ॱ(false);
        o_chx.ॱ(o_dgp.ˊॱ());
        o_chx.ˏ(o_dgp.ʼ());
        o_chx.ˏ(o_dgp.ʻ());
        o_chx.ˏ(false);
        o_chx.ˎ(o_dgp.ᐝ());
        o_chx.ˋ(chb.ˊ);
        cjm ˎ = ˎ(o_chx);
        if (ˎ == null) {
            Logger.e("AppListFragment", "getItem, offer == null, position: " + i);
            return new Fragment();
        }
        Fragment ˊ = cjk.ˎ().ˊ(ˎ);
        fsd.ॱ(ˊ, "Launcher.getLauncher().makeFragment(offer)");
        return ˊ;
    }

    private final cjm ˎ(chx o_chx) {
        try {
            AppListFragmentProtocol appListFragmentProtocol = new AppListFragmentProtocol();
            AppListFragmentRequest appListFragmentRequest = new AppListFragmentRequest();
            appListFragmentRequest.ˎ(o_chx);
            appListFragmentProtocol.ˏ(appListFragmentRequest);
            return new cjm("simple.list.fragment", appListFragmentProtocol);
        } catch (IllegalArgumentException e) {
            Logger.e("MultiTabsFragmentTabHostAdapter", "getTabFragmentOffer IllegalArgumentException!");
            return null;
        } catch (ClassCastException e2) {
            Logger.e("MultiTabsFragmentTabHostAdapter", "getTabFragmentOffer ClassCastException!");
            return null;
        }
    }

    public void ˏ(int i, @NotNull Fragment fragment, @Nullable Fragment fragment2) {
        Fragment fragment3;
        ciy o_ciy;
        fsd.ˊ((Object) fragment, "currObj");
        if (this.ˊ) {
            if (fragment instanceof ciy) {
                fragment3 = fragment;
            } else {
                fragment3 = null;
            }
            o_ciy = (ciy) fragment3;
            if (o_ciy != null) {
                o_ciy.ˋ(i);
            }
        } else {
            o_ciy = (ciy) (!(fragment instanceof ciy) ? null : fragment);
            if (o_ciy != null) {
                o_ciy.ʽˊ();
            }
        }
        if (fragment2 instanceof ciy) {
            fragment3 = fragment2;
        } else {
            fragment3 = null;
        }
        o_ciy = (ciy) fragment3;
        if (o_ciy != null) {
            o_ciy.ʽˊ();
        }
        ˋ(fragment, 0);
        if (fragment2 != null) {
            ˋ(fragment2, 4);
        }
    }

    public boolean ˎ(int i, @NotNull TabSpec tabSpec) {
        fsd.ˊ((Object) tabSpec, "tabSpec");
        if (CollectCheck.isEmpty(this.ˎ)) {
            Logger.e("AppListFragment", "empty tabItemList. createTabSpec position = " + i);
            return false;
        }
        tabSpec.setIndicator(((dgp) this.ˎ.get(i)).ˊ());
        return true;
    }

    @NotNull
    public String ˊ(int i) {
        if (CollectCheck.isEmpty(this.ˎ)) {
            Logger.e("AppListFragment", "empty tabItemList. getTabSpecTag position = " + i);
            return String.valueOf(i);
        }
        String ˏ = ((dgp) this.ˎ.get(i)).ˏ();
        fsd.ॱ(ˏ, "tabItemList[position].tabId");
        return ˏ;
    }
}
